/****************************************************
          File Name:15-1_imply.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sun Jan 11 05:04:09 2015
*****************************************************/

#include "15-1.h"

bool Tv::volup()
{
    if(volume < Maxval)
    {
        volume++;
        return true;
    }
    else
        return false;
}

bool Tv::voldown()
{
    if(volume > Minval)
    {
        volume--;
        return true;
    }
    else
        return false;
}

void Tv::chanup()
{
    if(channel < maxchannel)
        channel++;
    else
        channel = 1;
}

void Tv::chandown()
{
    if(channel > 1)
        channel--;
    else
        channel = maxchannel;
}

void Tv::settings() const
{
    using std::cout;
    using std::endl;

    cout << "TV is " << (state == Off ? "Off" : "On") << endl;
    if(state == On)
    {
        cout << "Volume settings = " << volume << endl;
        cout << "Mode = "
            << (mode == Antenna? "Antenna":"Cable") << endl;
        cout << "Input = "
            << (input == TV ? "TV" : "DVD") << endl;
    }
}  